<template>
  <div>
    <p class="title">推荐歌单</p>
    <!-- 推荐歌单 -->
    <van-row gutter="6">
      <van-col span="8" v-for="obj in reList" :key="obj.id">
        <van-image width="100%" height="3rem" fit="cover" :src="obj.picUrl" />
        <p class="song_name">{{ obj.name }}</p>
      </van-col>
    </van-row>
    <p class="title">最新音乐</p>
    <div class="main">
      <song-item
        v-for="obj in newSongs"
        :key="obj.id"
        :name="obj.name"
        :author="obj.song.artists[0].name"
        :id="obj.id"
      ></song-item>
      <!-- <van-cell
        center
        :title="obj.name"
        :label="obj.song.artists[0].name + ' - ' + obj.name"
        v-for="obj in newSongs"
        :key="obj.id"
      >
        -->
      <!--  使用 right-icon 插槽来自定义右侧图标 -->
      <!-- <template #right-icon>
          <van-icon name="play-circle-o" size="0.6rem" />
        </template>
      </van-cell> -->
    </div>
  </div>
</template>

<script>
import songItem from "@/components/songItem.vue";
import { recommendMusicApi, newSongs } from "@/api";
export default {
  data() {
    return {
      reList: [],
      newSongs: [],
    };
  },
  async created() {
    const res = await recommendMusicApi({
      limit: 6, //传入接口参数，查询数据条数
    });
    console.log(res);
    this.reList = res.data.result;
    const songs = await newSongs({
      limit: 10,
    });
    console.log(songs);
    this.newSongs = songs.data.result;
  },
  components: {
    songItem,
  },
};
</script>

<style>
.van-cell__value {
  display: none;
}
.title {
  padding: 0.266667rem 0.24rem;
  margin: 0 0 0.24rem 0;
  background-color: #eee;
  color: #333;
  font-size: 15px;
}
/* 推荐歌单 - 歌名 */
.song_name {
  font-size: 0.346667rem;
  padding: 0 0.08rem;
  margin-bottom: 0.266667rem;
  word-break: break-all;
  text-overflow: ellipsis;
  display: -webkit-box; /** 对象作为伸缩盒子模型显示 **/
  -webkit-box-orient: vertical; /** 设置或检索伸缩盒对象的子元素的排列方式 **/
  -webkit-line-clamp: 2; /** 显示的行数 **/
  overflow: hidden; /** 隐藏超出的内容 **/
}
.main {
  padding-bottom: 0.625rem;
}
</style>
